<?php

class DBUrl extends DBString {

    public static function create($value) {

        $result = parent::create($value);

        if(strlen($result) > 0) {
            if(!filter_var($result, FILTER_VALIDATE_URL))
                throw new Exception(_("Failed to validate url")." $result");

            if(strpos($result, 'http://') === false)
                $result = 'http://' . $result;
        }

        return $result;
    }
}